A storage apparatus such as a hard disk drive (HDD) or a solid-state drive (SSD) generally comprises a host interface unit. The host interface unit controls data transfers between a host and the storage apparatus. The host interface unit comprises a command management device. The command management device receives commands such as read commands or write commands transferred by the host. The command management device then stores the received commands in a command buffer. The commands stored in the command buffer are unloaded into a processing unit in order of storage (that is, in the order in which the commands are stored) under the management of the command management device. The processing unit executes each of the unloaded commands.
When the execution of the command unloaded from the command buffer is completed, the command becomes unnecessary. Then, an area in the command buffer in which the unnecessary command is stored needs to be released (this area is hereinafter referred to as an unnecessary area). The release of such an unnecessary area (that is, maintenance of the command buffer) is carried out by software processing such as compaction or garbage collection.
On the other hand, in digital communication systems, a buffer management subsystem is known which comprises a data buffer configured to sequentially store received data. The buffer management subsystem comprises a first-in first-out buffer configured to store buffer pointers pointing to free spaces (that is, unnecessary areas) in the data buffer (this first-in first-out buffer is hereinafter referred to as a buffer pointer FIFO). The received data is stored in an area in the data buffer specified by a buffer pointer unloaded from the buffer pointer FIFO. A group of data stored in the data buffer is unloaded in order of storage and then transferred to relevant destinations. When data is unloaded from the data buffer, an area in the data buffer in which the unloaded data is stored becomes free. Thus, a buffer pointer pointing to this free area is stored in the buffer pointer FIFO.
With the above-described compaction or garbage collection, releasing an unnecessary area at a high speed is difficult. On the other hand, the order in which the execution of the commands stored in the command buffer is completed does not necessarily match the order in which the commands are unloaded from the command buffer. Thus, the physical sequence of the commands stored in the command buffer is significantly shifted from the unloading order (that is, the storage order) of the commands over time. Hence, in a command management device that needs to unload the commands stored in the command buffer, in order of storage, it is difficult to release an unnecessary area in the command buffer using the buffer pointer FIFO instead of the compaction or garbage collection.